//
//  WDGoutMaintenanceVehicleScanCodeViewModel.h
//  wd-serviceapp
//
//  Created by Bin Tang on 2025/2/17.
//

#import "TYZBaseViewModel.h"
#import "WDScanCodeViewModel.h"
#import "WDArrivalServiceItemModel.h"
#import "EDSImageVideoModel.h"
#import "WDRescueFinishRepairRequest.h" // 完成 本次维修

NS_ASSUME_NONNULL_BEGIN

/// 工单界面-外出-维修中 - 扫码
@interface WDGoutMaintenanceVehicleScanCodeViewModel : TYZBaseViewModel

@property (nonatomic, strong) WDArrivalServiceItemModel *serviceModel;

@property (nonatomic, strong) WDRescueFinishRepairReqModel *reqModel;

/// 标题
@property (nonatomic, copy) NSString *scanTitle;


@property (nonatomic, assign) CGRect scanRect;//扫描区域的frame

@property (nonatomic, assign) BOOL isShowLightBtn;
@property (nonatomic, assign) BOOL isShowInputBtn;
@property (nonatomic, copy) NSString *inputBtnTitle;
@property (nonatomic, copy) NSString *tipMsg;

/// 下方描述
@property (nonatomic, copy) NSString *tipInfo;

@property (nonatomic, strong) AVCaptureDevice *device;
@property (nonatomic, strong) AVCaptureDeviceInput *deviceInput;
@property (nonatomic, strong) AVCaptureMetadataOutput *dataOutput;
@property (nonatomic, strong, nullable) AVCaptureSession *session;
@property (nonatomic, strong) AVCaptureVideoPreviewLayer *previewLayer;

@property (nonatomic, copy) void(^touchScanCodeResultBlock)(NSString *scanCode, NSString *scanType);





- (UIImage *)imageWithName:(NSString *)imageName;

- (void)setupSession:(UIViewController *)vc;

/// 开始扫描
- (void)startScan:(void(^)(void))completion;

/// 停止扫描
- (void)stopScan:(void(^)(void))completion;

- (void)turnTorch:(BOOL)on;


/// 判断相机是否可用
- (BOOL)isCameraAvailable;

/// 判断前置相机是否可用
- (BOOL)isFrontCameraAvailable;

/// 是否有后置摄像头
- (BOOL)isRearCameraAvailable;

/// 摄像头验证状态是否正确
- (BOOL)isCameraAuthStatusCorrect;


/// 完成检查 开始维修
/// - Parameter completion: completion description
- (void)requestWithTaskFinishInspect:(RequestCompletionBlock)completion;

@end

NS_ASSUME_NONNULL_END
